//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	IEventManager.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

namespace Smart.Common
{
	/// <summary>
	/// Event manager
	/// </summary>
	public interface IEventManager
	{
		/// <summary>
		/// Register event handler for named event, handler returns false, to stop processing
		/// </summary>
		/// <param name="webName">Web.Name or EventManager.AnyWeb or "/"</param>
		/// <param name="eventName">Event name</param>
		/// <param name="priority"> 0 - highest priority</param>
		/// <param name="handler">Event handler</param>
		void Register<TArg1>(string webName, string eventName, int priority, NamedEventHandler<TArg1> handler);

		/// <summary>
		/// Register event handler for named event, handler returns false, to stop processing
		/// </summary>
		/// <param name="webName">Web.Name or EventManager.AnyWeb or "/"</param>
		/// <param name="eventName">Event name</param>
		/// <param name="priority"> 0 - highest priority</param>
		/// <param name="handler">Event handler</param>
		void Register<TArg1, TArg2>(string webName, string eventName, int priority, NamedEventHandler<TArg1, TArg2> handler);

		/// <summary>
		/// Register event handler for named event, handler returns false, to stop processing
		/// </summary>
		/// <param name="webName">Web.Name or EventManager.AnyWeb or "/"</param>
		/// <param name="eventName">Event name</param>
		/// <param name="priority"> 0 - highest priority</param>
		/// <param name="handler">Event handler</param>
		void Register<TArg1, TArg2, TArg3>(string webName, string eventName, int priority, NamedEventHandler<TArg1, TArg2, TArg3> handler);

		/// <summary>
		/// Register event handler for named event, handler returns false, to stop processing
		/// </summary>
		/// <param name="webName">Web.Name or EventManager.AnyWeb or "/"</param>
		/// <param name="eventName">Event name</param>
		/// <param name="priority"> 0 - highest priority</param>
		/// <param name="handler">Event handler</param>
		void Register<TArg1, TArg2, TArg3, TArg4>(string webName, string eventName, int priority, NamedEventHandler<TArg1, TArg2, TArg3, TArg4> handler);

		/// <summary>
		/// Register event handler for named event, handler returns false, to stop processing
		/// </summary>
		/// <param name="eventName">Event name</param>
		/// <param name="priority"> 0 - highest priority</param>
		/// <param name="handler">Event handler</param>
		void Register<TArg1>(string eventName, int priority, NamedEventHandler<TArg1> handler);

		/// <summary>
		/// Register event handler for named event, handler returns false, to stop processing
		/// </summary>
		/// <param name="eventName">Event name</param>
		/// <param name="priority"> 0 - highest priority</param>
		/// <param name="handler">Event handler</param>
		void Register<TArg1, TArg2>(string eventName, int priority, NamedEventHandler<TArg1, TArg2> handler);

		/// <summary>
		/// Register event handler for named event, handler returns false, to stop processing
		/// </summary>
		/// <param name="eventName">Event name</param>
		/// <param name="priority"> 0 - highest priority</param>
		/// <param name="handler">Event handler</param>
		void Register<TArg1, TArg2, TArg3>(string eventName, int priority, NamedEventHandler<TArg1, TArg2, TArg3> handler);

		/// <summary>
		/// Register event handler for named event, handler returns false, to stop processing
		/// </summary>
		/// <param name="eventName">Event name</param>
		/// <param name="priority"> 0 - highest priority</param>
		/// <param name="handler">Event handler</param>
		void Register<TArg1, TArg2, TArg3, TArg4>(string eventName, int priority, NamedEventHandler<TArg1, TArg2, TArg3, TArg4> handler);

		/// <summary>
		/// Unregister event handler for named event
		/// </summary>
		/// <param name="webName">Web.Name or EventManager.AnyWeb</param>
		/// <param name="eventName">Event name</param>
		/// <param name="handler">Event handler</param>
		void Unregister<TArg1>(string webName, string eventName, NamedEventHandler<TArg1> handler);

		/// <summary>
		/// Unregister event handler for named event
		/// </summary>
		/// <param name="webName">Web.Name or EventManager.AnyWeb</param>
		/// <param name="eventName">Event name</param>
		/// <param name="handler">Event handler</param>
		void Unregister<TArg1, TArg2>(string webName, string eventName, NamedEventHandler<TArg1, TArg2> handler);

		/// <summary>
		/// Unregister event handler for named event
		/// </summary>
		/// <param name="webName">Web.Name or EventManager.AnyWeb</param>
		/// <param name="eventName">Event name</param>
		/// <param name="handler">Event handler</param>
		void Unregister<TArg1, TArg2, TArg3>(string webName, string eventName, NamedEventHandler<TArg1, TArg2, TArg3> handler);

		/// <summary>
		/// Unregister event handler for named event
		/// </summary>
		/// <param name="webName">Web.Name or EventManager.AnyWeb</param>
		/// <param name="eventName">Event name</param>
		/// <param name="handler">Event handler</param>
		void Unregister<TArg1, TArg2, TArg3, TArg4>(string webName, string eventName, NamedEventHandler<TArg1, TArg2, TArg3, TArg4> handler);

		/// <summary>
		/// Unregister all event handlers for named event
		/// </summary>
		/// <param name="eventName">Event name</param>
		void Unregister(string eventName);

		/// <summary>
		/// Unregister all event handlers for named event
		/// </summary>
		/// <param name="webName">Web.Name or EventManager.AnyWeb</param>
		/// <param name="eventName">Event name</param>
		void Unregister(string webName, string eventName);

		/// <summary>
		/// Fire event in current Web
		/// </summary>
		void FireEvent<TArg1>(string eventName, TArg1 arg1);

		/// <summary>
		/// Fire event in current Web
		/// </summary>
		void FireEvent<TArg1, TArg2>(string eventName, TArg1 arg1, TArg2 arg2);

		/// <summary>
		/// Fire event in current Web
		/// </summary>
		void FireEvent<TArg1, TArg2, TArg3>(string eventName, TArg1 arg1, TArg2 arg2, TArg3 arg3);

		/// <summary>
		/// Fire event in current Web
		/// </summary>
		void FireEvent<TArg1, TArg2, TArg3, TArg4>(string eventName, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4);

		/// <summary>
		/// Fire event in supplied Web
		/// </summary>
		void FireEvent<TArg1>(string webName, string eventName, TArg1 arg1);

		/// <summary>
		/// Fire event in supplied Web
		/// </summary>
		void FireEvent<TArg1, TArg2>(string webName, string eventName, TArg1 arg1, TArg2 arg2);

		/// <summary>
		/// Fire event in supplied Web
		/// </summary>
		void FireEvent<TArg1, TArg2, TArg3>(string webName, string eventName, TArg1 arg1, TArg2 arg2, TArg3 arg3);

		/// <summary>
		/// Fire event in supplied Web
		/// </summary>
		void FireEvent<TArg1, TArg2, TArg3, TArg4>(string webName, string eventName, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4);
	}
}